package com.example.module_web.viewholder;

import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import java.util.HashMap;


/**
 * Created by ASUS on 2018/3/12.
 */

public class FormViewHolder extends RecyclerView.ViewHolder {
    private static final String TAG = "bug";
    private View mItemView;
    private HashMap<String, View> mItemViewIds;

    /**
     * @return 存储表格子项view的id的集合
     */
    public HashMap<String, View> getItemViewIds() {
        return mItemViewIds;
    }

    public FormViewHolder(View itemView, FormItemLayout itemLayout ) {
        super(itemView);
        Log.e(TAG, "FormViewHolder: 4" );
        this.mItemView = itemView;
        mItemViewIds = new HashMap<>();
        Log.e(TAG, "FormViewHolder: 5");
        mItemViewIds = itemLayout.onBindItemViewId(mItemViewIds,itemView);
        Log.e(TAG, "FormViewHolder: 9");
    }

    public View getItemView() {
        return mItemView;
    }


    public interface FormItemLayout{
        /**
         * 绑定子项view的id 到 view 的实例中
         * @param holder 存储表格子项view的id的集合
         * @param itemView 表格子项布局的实例
         * @return
         */
        HashMap<String,View> onBindItemViewId(HashMap<String,View> holder,View itemView);
    }

}
